var webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
console.log(__dirname)

module.exports = {
    entry: {
        history: './src/main.js',
    },
    output: {
        path: __dirname,
        filename: './build.js'
    },
    module: {
        loaders: [
            {
                // edit this for additional asset file types
                test: /\.(png|jpg|gif)$/, 
                loader: 'url-loader?limit=819200'
            },
            {
                test: /\.js$/,
                exclude: /node_modules|vue\/dist|vue-router\/|vue-loader\/|vue-hot-reload-api\//,
                loader: 'babel-loader',
                query: {
                     presets: ['es2015', 'stage-0', 'react'],
                     plugins: [
                       ['import', [{ libraryName: "antd"}]],
                     ],
                }
            },
            {   test: /\.css$/, 
                loader: 'style-loader!css-loader?sourceMap' 
            },
            {   
                test: /\.scss$/, 
                loader: "style!css!sass?sourceMap"
            },
            {
                test: /\.less$/,
                loader: "style-loader!css-loader!less-loader?sourceMap"
            },
            {
                test: /\.json$/,
                loader: "json-loader"
            },
            { 
                test: /\.(woff|svg|eot|ttf)\??.*$/,
                loader: 'url-loader?limit=50000&name=[path][name].[ext]'
            }
        ]
    },
    plugins: [
        new ExtractTextPlugin('bundle.min.css', {allChunks: false}),
        // new webpack.optimize.UglifyJsPlugin({
        //     output: {
        //         comments: false,  // remove all comments
        //     },
        //     compress: {
        //         warnings: false
        //     }
        // }),
        // new webpack.DefinePlugin({
        //     'process.env': {
        //         NODE_ENV: JSON.stringify('production'),
        //     },
        // }),
        // new webpack.ProvidePlugin({
        //     $: "jquery",
        //     jQuery: "jquery",
        //     "window.jQuery": "jquery"
        // })
        // new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js', Infinity) // 这是第三方库打包生成的文件
    ]
}
